x11: Stop reordering visuals
authorBenjamin Otte <otte@redhat.com>
Thu, 3 Jun 2021 02:54:37 +0000 (04:54 +0200)
committerBenjamin Otte <otte@redhat.com>
Thu, 22 Jul 2021 14:06:05 +0000 (16:06 +0200)
The old code was ordering visuals by depth, but considering that these
days we either use the default visual or a 32bit RGBA visual, that
reordering does not have an effect anymore.

In theory, the only effect is that the GLX Visual selection might select
a different replacement Visual when it checks for improved GL Visuals, but
even there I can't come up with a case where that matters, because
again, the visuals are only reordered by depth and we want to keep the
depth.

In any case, make this a separate commit so bisecting can find this
problem if it ever shows up.

gdk/x11/gdkvisual-x11.c

index 0a6ec4addad9f79d2a072d616fa6f8855743908f..ceeaec47c8d70aa30e694423d1257129b69fc038 100644 (file)
@@ -65,7 +65,6 @@ _gdk_x11_screen_init_visuals (GdkX11Screen *x11_screen)
 
   XVisualInfo *visual_list;
   XVisualInfo visual_template;
-  GdkX11Visual *temp_visual;
   Visual *default_xvisual;
   GdkX11Visual **visuals;
   int nxvisuals;
@@ -142,40 +141,6 @@ _gdk_x11_screen_init_visuals (GdkX11Screen *x11_screen)
   if (visual_list)
     XFree (visual_list);
 
-  for (i = 0; i < nvisuals; i++)
-    {
-      for (j = i+1; j < nvisuals; j++)
-       {
-         if (visuals[j]->depth >= visuals[i]->depth)
-           {
-             if ((visuals[j]->depth == 8) && (visuals[i]->depth == 8))
-               {
-                 if (visuals[j]->type == GDK_VISUAL_PSEUDO_COLOR)
-                   {
-                     temp_visual = visuals[j];
-                     visuals[j] = visuals[i];
-                     visuals[i] = temp_visual;
-                   }
-                 else if ((visuals[i]->type != GDK_VISUAL_PSEUDO_COLOR) &&
-                          visuals[j]->type > visuals[i]->type)
-                   {
-                     temp_visual = visuals[j];
-                     visuals[j] = visuals[i];
-                     visuals[i] = temp_visual;
-                   }
-               }
-             else if ((visuals[j]->depth > visuals[i]->depth) ||
-                      ((visuals[j]->depth == visuals[i]->depth) &&
-                       (visuals[j]->type > visuals[i]->type)))
-               {
-                 temp_visual = visuals[j];
-                 visuals[j] = visuals[i];
-                 visuals[i] = temp_visual;
-               }
-           }
-       }
-    }
-
   for (i = 0; i < nvisuals; i++)
     {
       if (default_xvisual->visualid == GDK_X11_VISUAL (visuals[i])->xvisual->visualid)